﻿@using Volo.Abp.Users
@using Volo.Abp.MultiTenancy
@using Microsoft.Extensions.Localization
@using global::Localization.Resources.AbpUi
@inject ICurrentUser CurrentUser
@inject ICurrentTenant CurrentTenant
@inject IJSRuntime JsRuntime
@inject NavigationManager Navigation
@inject IStringLocalizer<AbpUiResource> L
<AuthorizeView>
    <Authorized>
        <BarDropdown RightAligned>
            <BarDropdownToggle>
                @if (CurrentTenant.Name != null)
                {
                    <Text><i>@CurrentTenant.Name</i>\@CurrentUser.UserName</Text>
                }
                else
                {
                    <Text>@CurrentUser.UserName</Text>
                }
            </BarDropdownToggle>
            <BarDropdownMenu>
                @if (Menu != null)
                {
                    @foreach (var menuItem in Menu.Items)
                    {
                        <BarDropdownItem To="@menuItem.Url?.TrimStart('~')" Target="new Target(menuItem.Target)">
                            @menuItem.DisplayName
                        </BarDropdownItem>
                    }
                }
            </BarDropdownMenu>
        </BarDropdown>
    </Authorized>
    <NotAuthorized>
        <BarLink To="/Account/Login">
            @L["Login"]
        </BarLink>
    </NotAuthorized>
</AuthorizeView>